package com.ks.network.controller;

import com.ks.core.base._ControllerBase;
import com.ks.core.core.Result;
import com.ks.core.dto.OperateBase;
import com.ks.core.dto.SearchCriteriaBase;
import com.ks.network.entity.BNetworkBase;
import com.ks.network.service.IBNetworkBaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * <p>
 * 服务网点-网点基本信息表 前端控制器
 * </p>
 *
 * @author kingdee123
 * @since 2020-12-21
 */
@RestController
@RequestMapping("/bNetworkBaseApp")
@Api(value = "应用端", description = "应用端")
public class BNetworkBaseAppController extends _ControllerBase {
    @Autowired
    private IBNetworkBaseService bNetworkBaseService;


    @PostMapping("/selectNetWork")
    @ApiOperation(value = "服务网点详情查询接口",notes = "服务网点详情查询接口")
    public Object selectNetWork (@RequestBody BNetworkBase bNetworkBase){
        Map<String,Object> resultMap =bNetworkBaseService.selectNetWork(getContext(),bNetworkBase);
        return Result.success(resultMap);
    }

    @PostMapping("/selectNetWorkList")
    @ApiOperation(value = "服务网点列表查询接口",notes = "fields查询搜索条件:state(状态),name(网点名称),area(省市区)")
    public Object selectNetWorkList (@RequestBody SearchCriteriaBase searchCriteriaBase){
        Map<String,Object> resultMap =bNetworkBaseService.selectNetWorkList(getContext(),searchCriteriaBase);
        return Result.success(resultMap);
    }

    @PostMapping("/addNetWork")
    @ApiOperation(value = "服务网点添加接口",notes = "服务网点添加接口")
    public Object addNetWork (@RequestBody BNetworkBase bNetworkBase){
        int resultMap =bNetworkBaseService.addNetWork(getContext(),bNetworkBase);
        return Result.success(resultMap);
    }

    @PostMapping("/deleteNetWork")
    @ApiOperation(value = "服务网点删除接口",notes = "服务网点删除接口")
    public Object deleteNetWork (@RequestBody OperateBase operateBase){
        int resultMap =bNetworkBaseService.deleteNetWork(getContext(),operateBase);
        return Result.success(resultMap);
    }

    @PostMapping("/updateNetWork")
    @ApiOperation(value = "服务网点修改接口",notes = "服务网点修改接口")
    public Object updateNetWork (@RequestBody BNetworkBase bNetworkBase){
        int resultMap =bNetworkBaseService.updateNetWork(getContext(),bNetworkBase);
        return Result.success(resultMap);
    }
}
